// mine/pages/teacherinfo/index.js
const $api = require("../../../api/mine").API

Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgurl:"https://img.yzcdn.cn/vant/cat.jpeg",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    var t = this
    t.getTeacherInfo()
  },

  gotoedit(e){
    var t = this
    wx.navigateTo({
      url:'/mine/pages/teacheredit/index'
    })
  },
  // 获取教师信息
  getTeacherInfo() {
    var t= this,
    data = {
      institution_id:wx.getStorageSync('TeacherClassinfo').institution_id,
      member_id:wx.getStorageSync('memberinfo').member_id
    }
    $api.getTeacherInfo(data).then(res=>{
      
      t.setData({
        info:res.data,
        jointime:parseInt((new Date().getTime() - new Date(res.data.start_time).getTime())/(365*24*60*60*1000))+1
      })
    })
  },

})